<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/logo.jpg">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/logo.jpg">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/logo.jpg">
  <link rel="mask-icon" href="/images/logo.jpg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"www.doubeecat.ga","root":"/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"right"},"copycode":{"enable":true,"show_result":true,"style":"flat"},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="2021.2.3 训练赛赛时通过：A C F G J K总体感觉打的比较捞，D是一个比较厉害的 DP">
<meta property="og:type" content="article">
<meta property="og:title" content="NWWRC2016 系列题解">
<meta property="og:url" content="https://www.doubeecat.ga/2021/02/03/NWWRC2016/index.html">
<meta property="og:site_name" content="Doubeecat&#39;s Blog">
<meta property="og:description" content="2021.2.3 训练赛赛时通过：A C F G J K总体感觉打的比较捞，D是一个比较厉害的 DP">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.luogu.com.cn/upload/image_hosting/bfzk634m.png">
<meta property="og:image" content="https://cdn.luogu.com.cn/upload/image_hosting/03oov9kp.png">
<meta property="og:image" content="https://cdn.luogu.com.cn/upload/image_hosting/amgm6akz.png">
<meta property="article:published_time" content="2021-02-03T13:44:32.000Z">
<meta property="article:modified_time" content="2021-02-09T15:23:21.974Z">
<meta property="article:author" content="Doubeecat">
<meta property="article:tag" content="树上问题">
<meta property="article:tag" content="思维">
<meta property="article:tag" content="构造">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.luogu.com.cn/upload/image_hosting/bfzk634m.png">

<link rel="canonical" href="https://www.doubeecat.ga/2021/02/03/NWWRC2016/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>NWWRC2016 系列题解 | Doubeecat's Blog</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">Doubeecat's Blog</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">“即便前路混沌，同她走过，才算人间。”</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/aboutme/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
        <li class="menu-item menu-item-2020-届招新">

    <a href="/new-oier-wanted/" rel="section"><i class="fa fa-calendar fa-fw"></i>2020 届招新</a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://www.doubeecat.ga/2021/02/03/NWWRC2016/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/logo.jpg">
      <meta itemprop="name" content="Doubeecat">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Doubeecat's Blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          NWWRC2016 系列题解
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-02-03 21:44:32" itemprop="dateCreated datePublished" datetime="2021-02-03T21:44:32+08:00">2021-02-03</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2021-02-09 23:23:21" itemprop="dateModified" datetime="2021-02-09T23:23:21+08:00">2021-02-09</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Codeforces%E8%B5%9B%E5%90%8E%E9%A2%98%E8%A7%A3/" itemprop="url" rel="index"><span itemprop="name">Codeforces赛后题解</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span>
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="far fa-comment"></i>
      </span>
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/2021/02/03/NWWRC2016/#valine-comments" itemprop="discussionUrl">
      <span class="post-comments-count valine-comment-count" data-xid="/2021/02/03/NWWRC2016/" itemprop="commentCount"></span>
    </a>
  </span>
  
  <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>7k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>6 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p>2021.2.3 训练赛<br>赛时通过：A C F G J K<br>总体感觉打的比较捞，D是一个比较厉害的 DP<br><a id="more"></a></p>
<blockquote>
<p>A.Anniversary Cake</p>
<p>给你一个 $w\times h$ 的矩形，在矩形中有两个整点。请你找到一种方案将矩形划分成两个部分，每个部分中各有一个点。</p>
<p>$w,h \leq 10^9$</p>
</blockquote>
<p>相对简单的构造题，大概在Div2A难度，考场上考虑比较simple所以挂了两发。</p>
<p>我们设两个点坐标为 $(x_1,y_1),(x_2,y_2)$ 一共有两种情况需要我们讨论，一种情况是横坐标相同，如图：</p>
<p><img src="https://cdn.luogu.com.cn/upload/image_hosting/bfzk634m.png" alt=""></p>
<p>这种情况下，我们可以直接构造到两个点的最左和最右端，即 $(0,y_1),(w,y_2)$ </p>
<p>第二种情况就是横坐标不同，如图：</p>
<p><img src="https://cdn.luogu.com.cn/upload/image_hosting/03oov9kp.png" alt=""></p>
<p>这种情况下，我们可以直接构造到两个点的最下和最上方，即 $(x_1,0),(x_2,h)$</p>
<p>想出方案后代码就很好写了。</p>
<p>Code:</p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">signed</span> <span class="title">main</span><span class="params">()</span> </span>&#123;</span><br><span class="line">    <span class="comment">//FO(anniversary)</span></span><br><span class="line">	read(w,h,x1,y1,x2,y2);</span><br><span class="line">    <span class="keyword">if</span> (x1 == x2) <span class="built_in">cout</span> &lt;&lt; <span class="number">0</span> &lt;&lt; <span class="string">" "</span> &lt;&lt; y1 &lt;&lt; <span class="string">" "</span> &lt;&lt; w &lt;&lt; <span class="string">" "</span> &lt;&lt; y2;</span><br><span class="line">    <span class="keyword">else</span> <span class="built_in">cout</span> &lt;&lt; x1 &lt;&lt; <span class="string">" "</span> &lt;&lt; <span class="number">0</span> &lt;&lt; <span class="string">" "</span> &lt;&lt; x2 &lt;&lt; <span class="string">" "</span> &lt;&lt; h;</span><br><span class="line">	<span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<blockquote>
<p>C.CodeCoder vs TopForces</p>
<p>有 $n$ 个人，每个人有两个能力值 $a_i$ 和 $b_i$。一个人能打败另一个人当且仅当这个人有一项或两项能力值都大于另一个人。也就是说当 A 比 B 强时可能有 B 比 A 强。</p>
<p>强的关系具有传递性，也就是说 A 比 B 强， B 比 C 强，那么 A 比 C 强。<br>求出每个人最多可以打败的人的个数。</p>
<p>$n \leq 10^5,a_i,b_i \leq 10^6$</p>
</blockquote>
<p>这个题很有意思，初看你可能感觉这个是个排序题，后面挂了一发才发现这个题没有那么简单。</p>
<p>对于这种关系可传递的题，我们有一个比较直接的想法是可以将其建成一张有向图。比如我们把样例建图完就是下面的样子：</p>
<p><img src="https://cdn.luogu.com.cn/upload/image_hosting/amgm6akz.png" alt=""></p>
<p>那么对于一个点 $i$，可以击败的人数就是 $i$ 的可达点数。</p>
<p>$O(n^2)$ 做法，对于每个点 dfs 一遍，得出每个点的可达点数量。</p>
<p>但是这样显然是过不去的，我们再从题目中观察条件。发现点 $i$ 可达点 $j$ 的要求是 $a_i &gt; a_j$ 或 $b_i &gt; b_j$。</p>
<p>我们就考虑能不能通过某些处理方法先优化掉一个条件。考虑如下的贪心策略：我们对于每个点按照 $a$ 或者 $b$ 排序（两个条件是等价的），然后对于每个 $b_i$ 较大的点，它前面的那些点是显然可达的。所以我们排序后依次 dfs,对于每个访问到的点打一个标记（后面的点肯定可以访问到），每次 dfs 都直接往答案中累加就行了。</p>
<p>Code:</p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">struct</span> <span class="title">node</span> &#123;</span></span><br><span class="line">    <span class="keyword">int</span> val,pos;</span><br><span class="line">&#125;a[N],b[N];</span><br><span class="line"></span><br><span class="line"><span class="keyword">int</span> n;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">bool</span> <span class="title">cmp</span><span class="params">(node p,node q)</span> </span>&#123;</span><br><span class="line">    <span class="keyword">return</span> p.val &lt; q.val;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="built_in">vector</span> &lt;<span class="keyword">int</span>&gt; G[N];</span><br><span class="line"></span><br><span class="line"><span class="keyword">int</span> vis[N],ans,orz[N];</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">dfs</span><span class="params">(<span class="keyword">int</span> x)</span> </span>&#123;</span><br><span class="line">    <span class="keyword">if</span> (!vis[x]) ++ans;</span><br><span class="line">    vis[x] = <span class="number">1</span>;</span><br><span class="line">    <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>;i &lt; G[x].size();++i) &#123;</span><br><span class="line">        <span class="keyword">int</span> y = G[x][i];</span><br><span class="line">        <span class="keyword">if</span> (!vis[y]) dfs(y);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">signed</span> <span class="title">main</span><span class="params">()</span> </span>&#123;</span><br><span class="line">	read(n);</span><br><span class="line">    <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">1</span>;i &lt;= n;++i) &#123;</span><br><span class="line">        read(a[i].val,b[i].val);</span><br><span class="line">        a[i].pos = i,b[i].pos = i;</span><br><span class="line">    &#125;</span><br><span class="line">    sort(a+<span class="number">1</span>,a+<span class="number">1</span>+n,cmp),sort(b+<span class="number">1</span>,b+<span class="number">1</span>+n,cmp);</span><br><span class="line">    <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">2</span>;i &lt;= n;++i) &#123;</span><br><span class="line">        G[a[i].pos].push_back(a[i<span class="number">-1</span>].pos),G[b[i].pos].push_back(b[i<span class="number">-1</span>].pos);</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">1</span>;i &lt;= n;++i) &#123;</span><br><span class="line">        <span class="keyword">if</span> (!vis[a[i].pos]) dfs(a[i].pos);</span><br><span class="line">        orz[a[i].pos] = ans - <span class="number">1</span>;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">1</span>;i &lt;= n;++i) &#123;</span><br><span class="line">        <span class="built_in">printf</span>(<span class="string">"%d\n"</span>,orz[i]);</span><br><span class="line">    &#125;</span><br><span class="line">	<span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<blockquote>
<p>F.Folding</p>
<p>求一个 $W \times H$ 的矩形通过折叠变为一个 $w\times h$ 的矩形的最少折叠次数，其中每次折叠的折痕必须平行于矩形的一边。</p>
<p>$1\le W,H,w,h\le10^9$</p>
</blockquote>
<p><del>场上队友写挂好几发被我撵下来了</del></p>
<p>首先这个题比较不喜欢的是它并没有保证长边和短边（队友就是在这里挂了好多发）所以先把短边和长边算出来，后文中提到的 $W,H,w,h$ 均保证 $W\leq H,w \leq h$，然后来讨论情况。</p>
<p>首先讨论无解的情况：显然，如果我们的最短边比目标最短边短，或者最长边比目标最长边短就无解了。你折纸总不可能越折越长对吧。</p>
<p>接着考虑有两种折叠情况：将 $W$ 变成 $w$，$H$ 变成 $h$。或者将 $W$ 变成 $h$，$H$ 变成 $w$.</p>
<p>所以代码就很好写了，我们不断用短边乘二靠近长边，统计次数即可。</p>
<p>Code:</p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">solve</span><span class="params">(<span class="keyword">int</span> y,<span class="keyword">int</span> x)</span> </span>&#123;</span><br><span class="line">    <span class="keyword">if</span> (x == y) <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">    <span class="keyword">int</span> cnt = <span class="number">0</span>;</span><br><span class="line">    <span class="keyword">while</span> (<span class="number">1</span>) &#123;</span><br><span class="line">        x *= <span class="number">2</span>;++cnt;</span><br><span class="line">        <span class="keyword">if</span> (x &gt;= y) <span class="keyword">return</span> cnt;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">signed</span> <span class="title">main</span><span class="params">()</span> </span>&#123;</span><br><span class="line">    <span class="comment">//FO(folding)</span></span><br><span class="line">	<span class="keyword">int</span> ans = <span class="number">0</span>;</span><br><span class="line">    read(a,b,c,d);</span><br><span class="line">    l1 = min(a,b),h1 = max(a,b),l2 = min(c,d),h2 = max(c,d);</span><br><span class="line">    <span class="keyword">if</span> (l2 &gt; l1 || h2 &gt; h1) &#123;</span><br><span class="line">        <span class="built_in">printf</span>(<span class="string">"-1"</span>);<span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">    &#125;</span><br><span class="line">    ans = min(solve(l1,l2) + solve(h1,h2),solve(l1,h2) + solve(h1,l2));</span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">"%d"</span>,ans);</span><br><span class="line">	<span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<blockquote>
<p>G.Gangsters in Central City<br>给出一棵含有 $n$ 个节点的，且 $1$ 为根节点的树，叶子节点都是房屋，让你在一个集合里面进行添加房屋和移除房屋的操作。</p>
<p>每一次添加和移除后，你将要回答下面两个问题：</p>
<ol>
<li><p>最少需要砍多少条边，才能使已选房屋都不能从根节点到达。</p>
</li>
<li><p>在第 $1$ 问的条件下，如何砍边使从根节点点开始走不能到达的非已选房屋数目最小，输出最小值。</p>
</li>
</ol>
<p>$n \leq 10^5$</p>
</blockquote>
<p>来补一个另外一个题解中说的神乎其神的 set 做法。</p>
<p>对于第一问，我们有个很简单的思考：我们显然只需要砍掉和根节点直接相关联的边即可满足最小。这个的证明十分显然，因为砍掉这些边显然能影响到的点是最多的。</p>
<p>然后我们来考虑第二问，一个最直接的想法：我们需要求出集合中靠的比较近的点的 LCA ，然后砍断这些 LCA 和父亲的连边。接下来就是两个问题：</p>
<ol>
<li>哪些点算是集合中靠的比较近的点？</li>
<li>怎么找到多个点的 LCA？</li>
</ol>
<p>第一个问题我们需要结合第一问来思考，第一问中，我们砍掉的都是直接和根节点关联的边，所以我们把集合中的点按照<strong>所属直接关联根节点的子树</strong>来分类。可能有些抽象，结合代码来理解。</p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">dfs2</span><span class="params">(<span class="keyword">int</span> x,<span class="keyword">int</span> anc)</span> </span>&#123;</span><br><span class="line">    bel[x] = anc;<span class="comment">//bel 记录的是这个点属于哪个</span></span><br><span class="line">    <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>;i &lt; G[x].size();++i) &#123;</span><br><span class="line">        <span class="keyword">int</span> y = G[x][i];</span><br><span class="line">        dfs2(y,anc);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">//in main</span></span><br><span class="line"><span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">1</span>;i &lt; n;++i) &#123;</span><br><span class="line">    <span class="keyword">int</span> x;<span class="built_in">cin</span> &gt;&gt; x;G[x].push_back(i+<span class="number">1</span>);</span><br><span class="line">    deg[x]++;</span><br><span class="line">    <span class="keyword">if</span> (x == <span class="number">1</span>) lis.push_back(i+<span class="number">1</span>);<span class="comment">//找出所有和根节点直接相连的点丢进vector里面</span></span><br><span class="line">&#125; </span><br><span class="line"><span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>;i &lt; lis.size();++i) &#123;</span><br><span class="line">    dfs2(lis[i],lis[i]);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>这样我们就把点按照从属的子树分成了几类。</p>
<p>第二个问题其实是之前刷知乎找到的，这里（<a href="https://www.zhihu.com/question/46440863/answer/165741734" target="_blank" rel="noopener">如何在 DAG 中找多个点的 LCA ? - 阮行止的回答 - 知乎</a>）有非常详细的证明，不再赘述。这里直接丢结论：<strong>树上多个点的LCA，就是DFS序最小的和DFS序最大的这两个点的LCA。</strong></p>
<p>所以我们对于每个子树内的点维护一个 <code>set</code>，每次取出 dfs 序最大点和 dfs 序最小点求出这些点的 LCA。我们可以算出砍掉一条边的代价为 这个点覆盖的叶子数 - 这棵子树里的被封锁节点数。</p>
<p>对于增加操作，我们先对于原来的 LCA 求出这个 LCA 控制的叶子节点数，再对插入点后的 LCA 求出这个 LCA 控制的叶子节点数，两者相减再扣去当前集合内的点数就是答案。</p>
<p>具体请看代码实现。</p>
<p>Code:</p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">int</span> bel[N];<span class="comment">//这个点属于哪个子树</span></span><br><span class="line"><span class="keyword">int</span> rul[N],dfn[N],cnt,deg[N],vis[N],rk[N];<span class="comment">//这个点管辖了几个叶子</span></span><br><span class="line"><span class="keyword">int</span> n,q;</span><br><span class="line"><span class="keyword">bool</span> leaf[N];</span><br><span class="line"></span><br><span class="line"><span class="built_in">vector</span> &lt;<span class="keyword">int</span>&gt; G[N],lis;</span><br><span class="line"></span><br><span class="line"><span class="built_in">set</span> &lt;<span class="keyword">int</span>&gt; s[N];</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">dfs1</span><span class="params">(<span class="keyword">int</span> x)</span> </span>&#123;</span><br><span class="line">    dfn[x] = ++cnt;rk[cnt] = x;<span class="comment">//求出每个点dfs序以及每个dfs序对应的点</span></span><br><span class="line">    <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>;i &lt; G[x].size();++i) &#123;</span><br><span class="line">        <span class="keyword">int</span> y = G[x][i];</span><br><span class="line">        dfs1(y);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">dfs2</span><span class="params">(<span class="keyword">int</span> x,<span class="keyword">int</span> anc)</span> </span>&#123;</span><br><span class="line">    <span class="comment">//printf("%d %d\n",x,anc);</span></span><br><span class="line">    bel[x] = anc;</span><br><span class="line">    <span class="keyword">if</span> (leaf[x]) &#123;<span class="comment">//求出每个点控制了多少个叶子节点</span></span><br><span class="line">        <span class="keyword">return</span> rul[x] = <span class="number">1</span>;</span><br><span class="line">    &#125; </span><br><span class="line">    <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>;i &lt; G[x].size();++i) &#123;</span><br><span class="line">        <span class="keyword">int</span> y = G[x][i];</span><br><span class="line">        rul[x] += dfs2(y,anc);</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">return</span> rul[x];</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">//树剖求LCA</span></span><br><span class="line"><span class="keyword">int</span> dep[N],top[N],siz[N],fat[N],son[N],ans1,ans2;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">dfs3</span><span class="params">(<span class="keyword">int</span> x,<span class="keyword">int</span> f)</span> </span>&#123;</span><br><span class="line">    siz[x] = <span class="number">1</span>,fat[x] = f,dep[x] = dep[f] + <span class="number">1</span>,son[x] = <span class="number">0</span>;</span><br><span class="line">    <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>;i &lt; G[x].size();++i) &#123;</span><br><span class="line">        <span class="keyword">int</span> y = G[x][i];</span><br><span class="line">        dfs3(y,x);</span><br><span class="line">        siz[x] += siz[y];</span><br><span class="line">        <span class="keyword">if</span> (siz[y] &gt; siz[son[x]]) &#123;</span><br><span class="line">            son[x] = y;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">dfs4</span><span class="params">(<span class="keyword">int</span> x,<span class="keyword">int</span> f)</span> </span>&#123;</span><br><span class="line">    <span class="keyword">if</span> (son[f] == x) top[x] = top[f];</span><br><span class="line">    <span class="keyword">else</span> top[x] = x;</span><br><span class="line">    <span class="keyword">if</span> (son[x]) dfs4(son[x],x);</span><br><span class="line">    <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>;i &lt; G[x].size();++i) &#123;</span><br><span class="line">        <span class="keyword">if</span> (G[x][i] != son[x]) dfs4(G[x][i],x);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">LCA</span><span class="params">(<span class="keyword">int</span> x,<span class="keyword">int</span> y)</span> </span>&#123;</span><br><span class="line">    <span class="keyword">while</span> (top[x] != top[y]) &#123;</span><br><span class="line">        <span class="keyword">if</span> (dep[top[x]] &lt; dep[top[y]]) swap(x,y);</span><br><span class="line">        x = fat[top[x]];</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">return</span> (dep[x] &lt; dep[y]) ? x : y;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">signed</span> <span class="title">main</span><span class="params">()</span> </span>&#123;</span><br><span class="line">	<span class="built_in">cin</span> &gt;&gt; n &gt;&gt; q;</span><br><span class="line">    <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">1</span>;i &lt; n;++i) &#123;</span><br><span class="line">        <span class="keyword">int</span> x;<span class="built_in">cin</span> &gt;&gt; x;G[x].push_back(i+<span class="number">1</span>);</span><br><span class="line">        deg[x]++;</span><br><span class="line">        <span class="keyword">if</span> (x == <span class="number">1</span>) lis.push_back(i+<span class="number">1</span>);<span class="comment">//先将直接相连的都丢到一个vector里</span></span><br><span class="line">    &#125; </span><br><span class="line">    <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">1</span>;i &lt;= n;++i) &#123;</span><br><span class="line">        <span class="keyword">if</span> (!deg[i]) leaf[i] = <span class="number">1</span>;<span class="comment">//维护所有叶子节点</span></span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>;i &lt; lis.size();++i) &#123;</span><br><span class="line">        dfs2(lis[i],lis[i]);</span><br><span class="line">    &#125;</span><br><span class="line">    dfs1(<span class="number">1</span>),dfs3(<span class="number">1</span>,<span class="number">0</span>),dfs4(<span class="number">1</span>,<span class="number">0</span>);</span><br><span class="line">    <span class="keyword">int</span> now = <span class="number">0</span>,las;</span><br><span class="line">    <span class="keyword">while</span> (q--) &#123;</span><br><span class="line">        <span class="keyword">char</span> opt;<span class="keyword">int</span> x;</span><br><span class="line">        <span class="built_in">cin</span> &gt;&gt; opt &gt;&gt; x;</span><br><span class="line">        <span class="comment">//now保存的是集合里一共有几个点。</span></span><br><span class="line">        <span class="keyword">if</span> (opt == <span class="string">'+'</span>) &#123;</span><br><span class="line">            ++now;las = <span class="number">0</span>;</span><br><span class="line">            <span class="keyword">if</span> (s[bel[x]].size()) &#123;</span><br><span class="line">                <span class="keyword">int</span> laslca = LCA(rk[*s[bel[x]].begin()],rk[*s[bel[x]].rbegin()]);</span><br><span class="line">                <span class="comment">//集合中最小和最大点LCA</span></span><br><span class="line">                las = rul[laslca];</span><br><span class="line">                <span class="comment">//LCA控制的点数</span></span><br><span class="line">            &#125;</span><br><span class="line">            s[bel[x]].insert(dfn[x]);</span><br><span class="line">            <span class="keyword">int</span> lca = LCA(rk[*s[bel[x]].begin()],rk[*s[bel[x]].rbegin()]);</span><br><span class="line">            <span class="keyword">if</span> (!vis[bel[x]]) ++ans1;</span><br><span class="line">            <span class="comment">//维护第一问</span></span><br><span class="line">            ++vis[bel[x]];</span><br><span class="line">            ans2 += rul[lca] - las; </span><br><span class="line">        &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">            <span class="comment">//与上方广义对称</span></span><br><span class="line">            --now;las = <span class="number">0</span>;</span><br><span class="line">            <span class="keyword">int</span> lca = LCA(rk[*s[bel[x]].begin()],rk[*s[bel[x]].rbegin()]);</span><br><span class="line">            s[bel[x]].erase(dfn[x]);</span><br><span class="line">            --vis[bel[x]];</span><br><span class="line">            <span class="keyword">if</span> (!vis[bel[x]]) --ans1;</span><br><span class="line">            <span class="keyword">if</span> (s[bel[x]].size()) &#123;</span><br><span class="line">                <span class="keyword">int</span> laslca = LCA(rk[*s[bel[x]].begin()],rk[*s[bel[x]].rbegin()]);</span><br><span class="line">                las = rul[laslca];</span><br><span class="line">            &#125;</span><br><span class="line">            ans2 -= rul[lca] - las; </span><br><span class="line">        &#125;</span><br><span class="line">        <span class="built_in">printf</span>(<span class="string">"%d %d\n"</span>,ans1,ans2-now);</span><br><span class="line">    &#125;</span><br><span class="line">	<span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<blockquote>
<p>K.King’s Heir</p>
<p>在国王去世的那一天，国王会让年龄最小但已满十八周岁的儿子继承国王，求哪一个儿子继承了国王，若没有儿子满足条件，则输出-1。保证国王不会有双胞胎。</p>
<p>$n \leq 100$</p>
</blockquote>
<p>签到题，<del>场上看到number第一反应就是有几个人导致挂了两发</del></p>
<p>直接扫一遍，这里用了一个比较巧妙的处理方法，注意到每个人的出生日期实际上是可以转化为 <code>yyyy/mm/dd</code> 的形式，我们可以用一个类似 <code>hash</code> 的办法把每个日期都化成一个整数，先判断是否满足条件，满足条件直接取最大值（出生日期最晚年龄最小）即可。</p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">int</span> n;</span><br><span class="line"></span><br><span class="line"><span class="keyword">int</span> a[N],b[N],c[N],x,y,z,ans,tmp;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">signed</span> <span class="title">main</span><span class="params">()</span> </span>&#123;</span><br><span class="line">    read(x,y,z,n);</span><br><span class="line">    <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">1</span>;i &lt;= n;++i) &#123;</span><br><span class="line">        read(a[i],b[i],c[i]);</span><br><span class="line">        <span class="keyword">if</span> (z - c[i] &gt; <span class="number">18</span>) &#123;</span><br><span class="line">            <span class="keyword">int</span> now = c[i] * <span class="number">10000</span> + b[i] * <span class="number">100</span> + a[i];</span><br><span class="line">            <span class="keyword">if</span> (now &gt; tmp) &#123;</span><br><span class="line">                tmp = now,ans = i;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">else</span> <span class="keyword">if</span> (z - c[i] == <span class="number">18</span>) &#123;</span><br><span class="line">            <span class="keyword">if</span> (b[i] &lt; y) &#123;   </span><br><span class="line">                <span class="keyword">int</span> now = c[i] * <span class="number">10000</span> + b[i] * <span class="number">100</span> + a[i];</span><br><span class="line">                <span class="keyword">if</span> (now &gt; tmp) &#123;</span><br><span class="line">                    tmp = now,ans = i;</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="keyword">else</span> <span class="keyword">if</span> (b[i] == y) &#123;</span><br><span class="line">                <span class="keyword">if</span> (a[i] &lt;= x) &#123;        </span><br><span class="line">                    <span class="keyword">int</span> now = c[i] * <span class="number">10000</span> + b[i] * <span class="number">100</span> + a[i];</span><br><span class="line">                    <span class="keyword">if</span> (now &gt; tmp) &#123;</span><br><span class="line">                        tmp = now,ans = i;</span><br><span class="line">                    &#125;</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">if</span> (ans) <span class="built_in">cout</span> &lt;&lt; ans;</span><br><span class="line">    <span class="keyword">else</span> <span class="built_in">cout</span> &lt;&lt; <span class="number">-1</span>;</span><br><span class="line">	<span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/%E6%A0%91%E4%B8%8A%E9%97%AE%E9%A2%98/" rel="tag"># 树上问题</a>
              <a href="/tags/%E6%80%9D%E7%BB%B4/" rel="tag"># 思维</a>
              <a href="/tags/%E6%9E%84%E9%80%A0/" rel="tag"># 构造</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2020/12/29/UVA1146/" rel="prev" title="UVA1146 Now or later 解题报告">
      <i class="fa fa-chevron-left"></i> UVA1146 Now or later 解题报告
    </a></div>
      <div class="post-nav-item"></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          
    <div class="comments" id="valine-comments"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Doubeecat"
      src="/images/logo.jpg">
  <p class="site-author-name" itemprop="name">Doubeecat</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">35</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">4</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">41</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/doubeecat" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;doubeecat" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:doubeecat@qq.com" title="E-Mail → mailto:doubeecat@qq.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://weibo.com/5884458071" title="Weibo → https:&#x2F;&#x2F;weibo.com&#x2F;5884458071" rel="noopener" target="_blank"><i class="fab fa-weibo fa-fw"></i>Weibo</a>
      </span>
  </div>


  <div class="links-of-blogroll motion-element">
    <div class="links-of-blogroll-title"><i class="fa fa-link fa-fw"></i>
      Links
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <a href="https://oierwanhong.cc/" title="https:&#x2F;&#x2F;oierwanhong.cc" rel="noopener" target="_blank">Wh's Blog</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://blog.csdn.net/weixin_42750325" title="https:&#x2F;&#x2F;blog.csdn.net&#x2F;weixin_42750325" rel="noopener" target="_blank">Young_Zn_Cu's Blog</a>
        </li>
    </ul>
  </div>

      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 2019 – 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-battery-full"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Doubeecat</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-area"></i>
    </span>
    <span title="站点总字数">89k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">1:21</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动
  </div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>




  















  

  
      

<script>
  if (typeof MathJax === 'undefined') {
    window.MathJax = {
      loader: {
        source: {
          '[tex]/amsCd': '[tex]/amscd',
          '[tex]/AMScd': '[tex]/amscd'
        }
      },
      tex: {
        inlineMath: {'[+]': [['$', '$']]},
        tags: 'ams'
      },
      options: {
        renderActions: {
          findScript: [10, doc => {
            document.querySelectorAll('script[type^="math/tex"]').forEach(node => {
              const display = !!node.type.match(/; *mode=display/);
              const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display);
              const text = document.createTextNode('');
              node.parentNode.replaceChild(text, node);
              math.start = {node: text, delim: '', n: 0};
              math.end = {node: text, delim: '', n: 0};
              doc.math.push(math);
            });
          }, '', false],
          insertedScript: [200, () => {
            document.querySelectorAll('mjx-container').forEach(node => {
              let target = node.parentNode;
              if (target.nodeName.toLowerCase() === 'li') {
                target.parentNode.classList.add('has-jax');
              }
            });
          }, '', false]
        }
      }
    };
    (function () {
      var script = document.createElement('script');
      script.src = '//cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js';
      script.defer = true;
      document.head.appendChild(script);
    })();
  } else {
    MathJax.startup.document.state(0);
    MathJax.texReset();
    MathJax.typeset();
  }
</script>

    

  


<script>
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
    var GUEST = ['nick', 'mail', 'link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item => {
      return GUEST.includes(item);
    });
    new Valine({
      el         : '#valine-comments',
      verify     : false,
      notify     : false,
      appId      : '6CGcUDbuD17aESA6Abl5FcK8-gzGzoHsz',
      appKey     : 'dopf8aMzWSSVJbvbge6BmWxi',
      placeholder: "Just go go",
      avatar     : 'mm',
      meta       : guest,
      pageSize   : '10' || 10,
      visitor    : false,
      lang       : '' || 'zh-cn',
      path       : location.pathname,
      recordIP   : false,
      serverURLs : ''
    });
  }, window.Valine);
});
</script>

</body>
</html>
